package com.erp.erp_servers.ShipmentPlan;

import com.erp.erp_entitys.ShipmentPlan.*;
import com.github.pagehelper.PageInfo;
import com.alibaba.fastjson.JSONObject;
import java.util.List;

public interface IShipmentPlanService {
    int deleteByPrimaryKey(Integer id);

    int insert(ShipmentPlan record);

    int insertSelective(ShipmentPlan record);

    ShipmentPlan selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(ShipmentPlan record);

    int updateByPrimaryKey(ShipmentPlan record);

    List<ShipmentPlan> selectShipmentPlanList(ShipmentPlanVo vo);

    PageInfo<ShipmentPlan> selectByIdList(List<Integer> list);

    int updateBoxStatusByKey(ShipmentPlanVo vo,String userCode);
    int updateBoxStatusByKey2(ShipmentPlanVo vo,String shipmentNO,String userCode);
    ShipmentPlan selectInfoById(Integer id);

    boolean isExist(String oddNumber);

    /**
     * 根据出运单号查询出运计划
     * @param code
     * @return
     */
    List<ShipmentPlan> findShipmentPlanByCode(String code);
    boolean getCount(String oddNumber);
    /**
     * 根据外销（备货）合同号、产品id查询出运计划中的产品数据信息
     * @param billNo
     * @param productNo
     * @param specNo
     * @return
     */
    int getPlanProduct(String billNo,String productNo,String specNo);

    /**
     * 根据外销（备货）合同号、产品id查询出运计划中的产品数据信息
     *
     * @return
     */
    int getPlanProductNum(String billNo,String productNo,String specNo, Integer productId);


    //******************  统计  ************************************

    /**
     * 出运结汇一览总表 统计
     * @param req
     * @return
     */
    public PageInfo<ShipmentPlanStatistics1Res> shipmentPlanStatistics1(ShipmentPlanStatistics1Req req);
    /**
     * 出运结汇一览总表-导出
     * @param req
     * @return
     */
    public JSONObject shipmentPlanStatistics1Export(ShipmentPlanStatistics1Req req);

    /**
     * 根据 外销合同号 产品编码 查询该产品的剩余数量
     * @param wxAndBhFlag w:外销，b:备货
     * @param shipmentPlanProductId 出运计划产品的id
     * @param exportCode 外销合同号
     * @param productCode 产品编码
     * @return 剩余数量
     */
    Integer surplusAmount(String wxAndBhFlag,Integer shipmentPlanProductId,Integer id,String exportCode,String productCode,String specNo);
}